﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Shared.Mappers;
using AutoMapper;

namespace DI
{
    public class AutoMapperAdapter : IObjMapper
    {
        private IMapper autoMapper;

        public AutoMapperAdapter(IMapper autoMapper)
        {
            this.autoMapper = autoMapper;
        }
        public IList<TDestination> MapList<TSource, TDestination>(IList<TSource> list)
        {
            return autoMapper.Map<IList<TSource>, IList<TDestination>>(list);
        }

        public TDestination Map<TDestination>(object source)
        {
            return autoMapper.Map<TDestination>(source);
        }

        public TDestination Map<TSource, TDestination>(TSource source, TDestination destination)
        {
            return autoMapper.Map<TSource, TDestination>(source, destination);
        }
    }
}
